import React, { memo, useContext } from 'react' 
import {UseContext,ThemeContext} from './context'

const UseContextDemo = memo(() => {
  // 在这个组件里使用 useContext
  // 我们在app 页面通过 useContext 插入了 一些值
  // 在组件里通过 useContext 来取这些值 

    const use = useContext(UseContext)
    const theme = useContext(ThemeContext)
    console.log('use',use,theme,'theme');
  return (
    <div>
      <h1>useContextDemo</h1>
      <h2>User:{use.name},age:{use.age}</h2>
      <h2>color:{theme.color},size:{theme.size}</h2>
    </div>
  )
})

export default UseContextDemo